<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>解构赋值</title>
</head>
<body>
    <script>
      let json = {
       a:12,
       b:5
      }
      let {a,b} = json;
      
      //数组解构赋值
      let arr = [2,3,4];
      let [arr1,arr2,arr3] = arr;
      console.log(arr1)
      
      //对象解构赋值
      let {a,b,c} = {a:16,b:17,c:20}
    </script>

    <!-- 
     注意事项:
     1.两边的结必须得一样
     2.右边必须得是个东西
     3.赋值和结构得同时完成

     -->
</body>
</html>